home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / txt132.exe / TXT132.DOC < prev   
Text File  |  1993-01-23  |  12KB  |  356 lines

  1. This package summarizes my findings on the possibilities of using some of
  2. the high resolution text modes with Turbo Vision.  Included are two demo
  3. programs to try various modes.  The first, LEVEL1, is the simplest but
  4. will not work with all mouse drivers.  LEVEL2 requires more changes but
  5. overcomes at least some of the mouse driver problems.  The executables
  6. for these two programs are included, but to compile your own modified
  7. versions, you'll need BP7.0 and the Run Time Library (RTL) source code
  8. as the library file DRIVERS.PAS needs to be modified.
  9.  
  10. The stimulus for this investigation was Paradox 4.0.  Paradox now has a
  11. Turbo Vision look and feel and it does support a number of high resolution
  12. text modes which can be selected from a menu.  Once I got into this
  13. investigation, I was surprised to find that Turbo Vision itself apparently
  14. has no problems handling odd text modes like 132x44, 80x60, etc.  There
  15. are problems, but they seem to be external to Turbo Vision:
  16.  
  17.   1. Not all mouse drivers work properly in the HiRes modes.  In particular,
  18.      LogiTech drivers do, MicroSoft's don't.  Positioning information
  19.      seems to be OK, but the screen is likely to get messed up with mouse
  20.      droppings.  I haven't had a chance to try other drivers.
  21.  
  22.   2. There's apparently no standard for hires modes.  Basic video boards
  23.      don't support any.  For more deluxe boards, different manufacturers
  24.      support different modes.
  25.  
  26.   3. Even if the video board support a particular mode the monitor may not
  27.      be able to synchronize satisfactorily.
  28.  
  29.   4. There seems to be no way for the software to tell in advance if a
  30.      mode is supported.  The effects of attempting to change to an
  31.      unsupported mode vary.  Often nothing happens.  Other times the screen
  32.      may black out or become extremely garbled.
  33.  
  34.   5. The possibility exists for damage to the monitor for modes that
  35.      don't synchronize correctly.  Don't leave a monitor in a condition
  36.      where it's obviously not working correctly.  It may be necessary to
  37.      reboot.
  38.  
  39. Below is a summary of various hires modes.  This info comes from the file,
  40. PARADOX.VID, which apparently is the basis for the Paradox video menu
  41. selection list.
  42.  
  43.     Board                Mode (decimal)       Width x Height
  44.  
  45.   VGA Wizard             50                   80x34
  46.                          51                   80x45
  47.                          35                   132x25
  48.                          34                   132x44
  49.  
  50.   ATI VGA                35                   132x25
  51.                          51                   132x44
  52.  
  53.   Compaq VGS             35                   132x25
  54.                          36                   132x28
  55.                          34                   132x43
  56.                          39                   132x50
  57.                          40                   132x60
  58.  
  59.   Genoa VGA              35                   132x25
  60.                          36                   132x28
  61.                          34                   132x43
  62.  
  63.   Orchid VGA             38                   80x60
  64.                          35                   132x25
  65.                          36                   132x28
  66.                          34                   132x44
  67.  
  68.   Paradise EGA/VGA       85                   132x25
  69.                          84                   132x43
  70.  
  71.   Sigma VGA              28                   132x25
  72.                          29                   132x44
  73.  
  74.   STB VGA                35                   132x25
  75.                          34                   132x44
  76.  
  77. PARADOX.VID also contains info on Video-7 and Everex boards, but I'm not
  78. able at present to interpret exactly what it means.  At this time, I've
  79. had success using the Orchid (but with a Cardinal video card) and ATI
  80. modes listed above.
  81.  
  82.  
  83. Program Level1
  84.  
  85. Level1 is a demo program which may work depending on your mouse driver.
  86. From the Video selection in the menu, you can select the normal TV
  87. 80x25 and 80x50 modes along with 'Other'.  'Other' brings up an inputbox
  88. in which you can enter a mode number to see what happens next.
  89.  
  90. A window contains information on the present state--the mode number,
  91. the contents of StartUpMode, and the current screen height and width.
  92. StartUpMode is the mode from which the program was called and is used
  93. to restore that mode on exit or when shelling to DOS.
  94.  
  95. To compile Level1.pas, you first have to modify DRIVERS.PAS.  The single
  96. modification consists of commenting out the last line of FixCrtMode, thus:
  97.  
  98.     (*MOV    AX,smCO80   *)
  99.  
  100. FixCrtMode is a routine which limits the video mode to monochrome or the
  101. standard VGA color modes.  Removing the last line effectively disables the
  102. routine so that any mode may be programed.
  103.  
  104. When doing a make on Level1.pas, the object directory list should include
  105. the directory where sysint.obj is located and the unit directory list
  106. should include the TV source directory (normally \bp\rtl\tv).
  107.  
  108.  
  109. Program Level2
  110.  
  111. If the mouse causes problems in the Level1 program, it's time to move on to
  112. Level2.  In Level2, the mouse driver cursor is hidden and the
  113. cursor displayed from DRIVERS.PAS.  The modifications required for
  114. DRIVERS.PAS are much more substantial.  Here they are:
  115.  
  116. Add the following to the Interface section:
  117.  
  118. const
  119.   SimulatedMouse : boolean = False;    {indicates if simulated mouse active}
  120.  
  121. procedure SimMouse;       {switch to simulated mouse}
  122. procedure DriverMouse;    {switch to normal driver mouse cursor}
  123.  
  124. These are the calls to switch back and forth between the normal usual mouse
  125. cursor and the simulated cursor.
  126.  
  127. Add the following just before the MouseInt procedure:
  128.  
  129. var
  130.   OldPos : word;       {marks the current mouse position}
  131.   HideCount : integer; {simulated mouse Hide count}
  132.  
  133. procedure SimMouse;
  134. begin
  135. HideMouse;
  136. SimulatedMouse := True;
  137. HideCount := 0;
  138. end;
  139.  
  140. procedure DriverMouse;
  141. begin
  142. SimulatedMouse := False;
  143. ShowMouse;
  144. end;
  145.  
  146. In MouseInt, change the lines:
  147.  
  148. @@1:    MOV    EventQTail,DI
  149.     INC    EventCount
  150. @@2:    MOV    MouseIntFlag,1
  151. end;
  152.  
  153. to:
  154.  
  155. @@1:    MOV    EventQTail,DI
  156.     INC    EventCount
  157. @@2:      cmp SimulatedMouse,0
  158.             je @@3               {this code for software mouse only}
  159.           cmp HideCount,0
  160.             ja @@3              {mouse is hidden}
  161.           mov al, ScreenWidth
  162.           xor ah,ah
  163.           mul mouseWhere.Y
  164.           add ax, MouseWhere.X
  165.           shl ax,1
  166.           les di, ScreenBuffer
  167.           add di,ax
  168.           cmp di,OldPos
  169.             je @@3     {no position change}
  170.           push di
  171.           mov di, OldPos   {change the old position back}
  172.           mov ax, ES:[di]
  173.           xor ah, $77      {invert the colors to where they were}
  174.           mov ES:[di], ax
  175.           pop di
  176.           mov ax, ES:[di]
  177.           xor ah, $77      {invert the colors}
  178.           mov ES:[di], ax
  179.           mov OldPos,di    {and save the position}
  180. @@3:    MOV    MouseIntFlag,1
  181. end;
  182.  
  183. Just before the ShowMouse procedure add:
  184.  
  185. procedure ShowMouse1;
  186. begin
  187. Dec(HideCount);
  188. if HideCount < 0 then HideCount := 0;   {synchronize}
  189. if HideCount = 0 then     {make mouse visible}
  190.   begin
  191.   asm
  192.           mov al, ScreenWidth
  193.           xor ah,ah
  194.           mul mouseWhere.Y
  195.           add ax, MouseWhere.X
  196.           shl ax,1
  197.           les di, ScreenBuffer
  198.           add di,ax
  199.           mov ax, ES:[di]
  200.           xor ah, $77      {invert the colors}
  201.           mov ES:[di], ax
  202.           mov OldPos,di    {and save the position}
  203.   end;
  204.   end;
  205. end;
  206.  
  207. At the start of the ShowMouse procedure change the following:
  208.  
  209. asm
  210.     CMP    ButtonCount,0
  211.     JE    @@1
  212.     PUSH    AX
  213.  
  214. to:
  215.  
  216. asm
  217.     CMP    ButtonCount,0
  218.     JE    @@1
  219.         cmp SimulatedMouse,0
  220.           je @@2
  221.         push ax
  222.         push bx
  223.         push cx
  224.         push dx
  225.         push si
  226.         push di
  227.         push es
  228.         call ShowMouse1
  229.         pop es
  230.         pop di
  231.         pop si
  232.         pop dx
  233.         pop cx
  234.         pop bx
  235.         pop ax
  236.         jmp @@1
  237.  
  238. @@2:    PUSH    AX
  239.  
  240.  
  241. Just before the HideMouse procedure, add:
  242.  
  243. procedure HideMouse1;
  244. begin
  245. if HideCount = 0 then
  246.   begin